package org.example.controller;

import com.qidian.common.pojo.MESResult;
import com.qidian.mes.pojo.Defect;
import com.qidian.mes.pojo.TestIndex;
import org.example.service.TestIndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 严伟伦
 * @Company 无
 * @Description
 * @Date: 2024/10/17 16:48
 */
@RestController
@RequestMapping("/testIndex")
@CrossOrigin
public class TestIndexController {
    @Autowired
    private TestIndexService testIndexService;
    @GetMapping("/list")
    public MESResult list(TestIndex testIndex, @RequestParam(defaultValue = "1")int page, @RequestParam(defaultValue = "10")int limit){
        return testIndexService.selectByPage(testIndex,page,limit);
    }

    @PostMapping("/add")
    public MESResult addTestIndex(@RequestBody TestIndex testIndex){

        return testIndexService.addTestIndex(testIndex);
    }


    @GetMapping("/selectTestIndexById")
    public MESResult selectTestIndexById(@RequestParam("indexId") int indexId){

        return testIndexService.selectTestIndexById(indexId);
    }


    @PutMapping("/update")
    public MESResult updateTestIndex(@RequestBody TestIndex testIndex){

        return testIndexService.updateTestIndex(testIndex);
    }

}
